import pandas as pd

# 读取Titanic数据集
data1 = pd.read_csv('titanic.csv')
data2=pd.read_csv('test.csv')
# 筛选出Rose和Jack的数据
rose_data = data1[
    (data1['Name'].str.contains('Mrs. John Jacob \(Madeleine Talmadge Force\) Astor', case=False)) &
    (data1['Pclass'] == 1)]

jack_data = data2[
    (data2['Name'].str.contains('Portaluppi, Mr. Emilio Ilario Giuseppe', case=False)) &
    (data2['Pclass'] != 1)]
# 输出验证结果
if len(rose_data) > 0:
    print("Rose是头等舱的乘客。")
else:
    print("Rose不是头等舱的乘客。")

if len(jack_data) > 0:
    print("Jack不是头等舱的乘客。")
else:
    print("Jack是头等舱的乘客。")